//
//  ArticlesTableViewCell.m
//  chanyou
//
//  Created by 高爽 on 15-1-4.
//  Copyright (c) 2015年 wanli. All rights reserved.
//

#import "ArticlesTableViewCell.h"

#import "Masonry.h"

#define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)

@implementation ArticlesTableViewCell

- (void)dealloc
{
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // self.backgroundColor = [UIColor cyanColor];
    
         self.imv = [[UIImageView alloc] init];
        _imv.layer.cornerRadius = 4;
        _imv.layer.masksToBounds = YES;
        [self.contentView addSubview:_imv];
        [_imv release];
        
        
        self.nameLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_nameLabel];
        [_nameLabel setTextColor:[UIColor whiteColor]];
        [_nameLabel setTextAlignment:NSTextAlignmentCenter];
        [_nameLabel setFont:[UIFont systemFontOfSize:22.0f]];
        [_nameLabel release];
        
        
        self.titleLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_titleLabel];
        [_titleLabel setFont:[UIFont systemFontOfSize:15]];
        // [_titleLabel setTextColor:[UIColor whiteColor]];
        [_titleLabel release];
        
    }return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    
    [self.imv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.mas_left).offset(9);
        make.top.equalTo(self.contentView.mas_top).offset(10);
        
        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH - 18, SCREEN_HEIGHT / 3 - 25));
    }];
    
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.imv.mas_left).offset(0);
        make.top.equalTo(self.imv.mas_top).offset(SCREEN_WIDTH / 4 - 10);
        
        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH, 25));
    }];

    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.imv.mas_left).offset(3);
        make.top.equalTo(self.imv.mas_top).offset(SCREEN_HEIGHT / 3 - 15);
        
        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH - 30, 15));
    }];
    
}
- (void)awakeFromNib {
    
}



- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
